use "${clean}analysis.dta", clear

keep if south == 1
keep if year < 1900

//standardizing variables
egen birth_county_surban = std(birth_county_urban_percent)
egen birth_county_srugged = std(birth_county_ruggedness)
egen birth_county_spostoffice = std(birth_county_postoffice_area)
egen sborn = std(born)

// creating a variable to keep the sample constant
cap drop sample
gen sample = 1
foreach var of varlist $county_bcontrols $life_controls {
	replace sample = . if `var' == .
}
keep if sample == 1

// creating southern democrat variable
cap drop southerndem
gen southerndem = (south == 1 & partyid == 0)

// graphing
twoway ///
	(scatteri 1 1865.5 1 1876, fcolor("${orange}") finten(inten10) recast(area)) ///
	(scatteri 1 1860.5 1 1865.5, fcolor("${orange}") finten(inten50) recast(area)) ///
	(lpoly rebel year if year>=1866, bwidth(3) lcolor("${red}") lwidth(thick) lpattern(dash)) ///
	(lpoly southerndem year if year>=1861, bwidth(3) lcolor("${blue}") lwidth(thick) lpattern(solid)) ///
	(lpoly southerndem year if year<=1860, bwidth(3) lcolor("${blue}") lwidth(thick) lpattern(solid)) ///
	, legend(ring(0) pos(5) col(1) order(4 "Southern Democrats" 3 "Fmr. Confed") region(lcolor(gs1)) ) ///
	xlab(1852(4)1900) ylab(0(.2)1, glcolor(gs15)) ///
	ytitle("Proportion of Southerners' Statements", size(medsmall)) xtitle(Year, size(medsmall) ) ///
	text(.95 1870.5 "Reconstruction", size(medsmall)) ///
	text(.95 1863 "Civil", size(medsmall)) ///
	text(.90 1863 "War", size(medsmall)) ///
	scheme(lean2) 	
graph export "${output}FigS10_southern_dems_rebels.pdf", as(pdf) replace
